package compare.comparable;
import java.util.Map;
import java.util.TreeMap;

public class demo {
    //
    public static void main1(String[] args) {
        Student student1 = new Student(1, "A");
        Student student2 = new Student(2, "B");
        //返回两个id之间的差值
        System.out.println(student1.compareTo(student2));
    }
    //
    public static void main(String[] args) {
        Student student1 = new Student(1, "A");
        Student student2 = new Student(2, "B");

        Map<Student, Integer> map = new TreeMap<>();
        map.put(student1, 1);
        map.put(student2, 5);
        for (Map.Entry<Student, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey() + " " + entry.getValue());
        }
        System.out.println("---------------------------------------------------");
    }
}